package org.netEase.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.netEase.dao.shangpingDao;
import org.netEase.dao.impl.shangpingDaoImple;
import org.netEase.entity.shangping;

import com.alibaba.fastjson.JSON;
@WebServlet(urlPatterns= {"/headergoods.shtml"})
public class headerGoodsAjax extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String shopName = "";
		shangpingDao shangpingDao = new shangpingDaoImple();
		String headershopname =request.getParameter("headershopname");
		if (headershopname != "" && headershopname != null) {
			shopName = headershopname;
		}
		List<shangping> headershopList =shangpingDao.listgetheadergoods(shopName);
		response.setContentType("application/json;charset=utf-8");
		String headershopList2=JSON.toJSONString(headershopList);
		response.getWriter().write(headershopList2);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	}
}
